package cn.org.itool.ws.framework.ws.group;

import cn.org.itool.ws.framework.netty.auth.Principal;
import cn.org.itool.ws.pojo.UserTag;
import io.netty.channel.Channel;
import io.netty.channel.group.ChannelGroup;

import java.util.List;
import java.util.Set;

public interface WsChannelGroup extends ChannelGroup {

    /**
     * 添加新的{@link Channel}, 如果相同用户已有则替换老的
     *
     * @param channel {@link Channel}
     * @param principal {@link Principal}
     * @param oChannels 用户已经存在{@link Channel}集合
     * @return true 添加成功
     */
    boolean put(Channel channel, Principal principal, List<Channel> oChannels);


    /**
     * 通过游戏玩家id, 获得channel
     * @param priId 用户Id
     */
    Channel findByPriId(String priId);

    public Set<String> priIdAll();

    public Set<UserTag> userTagAll();
}
